﻿--header SplitTrade
if (exists(
select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'iComply'
and TABLE_NAME='SplitTrade'))
begin
drop table icomply.SplitTrade
end

GO


CREATE TABLE [iComply].SplitTrade(
	[Id] [int] NOT NULL,
	[Size] [decimal](19, 4) not NULL,
	[ParentId] [int] not null,
 CONSTRAINT [PK_SplitTrade] PRIMARY KEY CLUSTERED  ([Id]))
 
GO

if (exists(
select * from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA = 'iComply'
and TABLE_NAME='TradeDetailedView'))
begin

drop table icomply.tradedetailedview

end

GO

CREATE TABLE [iComply].[TradeDetailedView](
	[Id] [int] NOT NULL,
	[Date] [datetime2](7) NOT NULL,
	[Quantity] [decimal](19, 4) NOT NULL,
	[Price] [decimal](19, 4) NULL,
	[Size] [decimal](19, 4) NULL,
	[FundBookEntityId] [int] NOT NULL,
	[SecurityId] [int] NOT NULL,
	[UnderlyingSecurityId] [int] NOT NULL,
	[CurrencyId] [int] NOT NULL,
	[PriorReturn] [decimal](19, 4) NOT NULL,
	[PercentageADV] [decimal](19, 4) NOT NULL,
	[PercentageTSO] [decimal](19, 4) NOT NULL,
	[SecurityName] [nvarchar](max) NOT NULL,
	[UnderlyingSecurityName] [nvarchar](max) NOT NULL,
	[FundBookEntityName] [nvarchar](max) NOT NULL,
	[MaxHeatScore] [float] NOT NULL,
	[SizeOverCapital] [decimal](19, 4) NULL,
 CONSTRAINT [PK_TradeDetailedView] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]


